import { User } from 'src/modules/system/user/entities/user.entity';
import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  OneToOne,
  ManyToOne,
  OneToMany,
  ManyToMany,
  JoinTable,
} from 'typeorm';
import { Exebook } from 'src/modules/questionbank/exebook/entities/exebook.entity';
import { Studycontent } from 'src/modules/studyresources/studycontent/entities/studycontent.entity';
import { Trainingtask } from 'src/modules/trainingtask/entities/trainingtask.entity';

@Entity('department')
export class Dept {
  @PrimaryGeneratedColumn('uuid')
  Id: string;
  @Column()
  Name: string; // 部门/班组名称
  @Column()
  Category: string; // 分类
  @Column()
  Type: string; // 业务类型
  @Column({ default: 0 })
  Deleted: number; // 删除标志，1为未删除，0为已删除
  @OneToMany(() => User, (user) => user.Dept)
  Users: User[]; // 公司下的用户列表

  @OneToMany(() => Exebook, (exebook) => exebook.Dept)
  Exebooks: Exebook[];

  @OneToMany(() => Studycontent, (contents) => contents.department)
  contents: Studycontent[];

  @OneToMany(() => Trainingtask, (trainingtask) => trainingtask.dept)
  Trainingtask: Trainingtask[];
}
